package com.briup.app02.service.impl;

import com.briup.app02.bean.Category;
import com.briup.app02.bean.extend.CategoryExtend;
import com.briup.app02.dao.CategoryMapper;
import com.briup.app02.service.ICategoryService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program: app02
 * @description: 分类管理的业务实现类
 * @author: charles
 * @create: 2020-06-10 10:50
 **/
@Service
public class CategoryServiceImpl implements ICategoryService {
    @Resource
    private CategoryMapper categoryMapper;
    /**
     * 查询所有
     *
     * @return
     */
    @Override
    public List<Category> findAll() {
        return categoryMapper.selectAll();
    }

    /**
     * 保存
     *
     * @param category
     */
    @Override
    public void save(Category category) {
        categoryMapper.insert(category);
    }

    /**
     * 查询栏目树
     *
     * @return
     */
    @Override
    public List<CategoryExtend> findCategoryTree() {
        return categoryMapper.selectCategoryTree();
    }
}
